/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.manager.editar;

import br.com.deployment.entidade.selo.TipoSelo;
import br.com.deployment.message.Msg;
import br.com.deployment.servico.TipoSeloServico;
import java.io.IOException;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author elyjr
 */

@ManagedBean
@SessionScoped
public class ManagerEditarTipoSelo  implements Serializable{
    
    @EJB
    TipoSeloServico tipoSeloServico;
    
    private TipoSelo tipoSelo;

    
    public ManagerEditarTipoSelo() {
    }
    
    public void redirect(String string, TipoSelo t) {
        try {
            FacesContext context = FacesContext.getCurrentInstance();
            tipoSelo = new TipoSelo();
            tipoSelo = t;
            context.getExternalContext().redirect(string);
        } catch (IOException ex) {
            Logger.getLogger(ManagerEditarTipoSelo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    
    public void atualizar(){
        tipoSeloServico.edit(tipoSelo);
        Msg.messagemInfo("Tipo Selo Atualizado com Sucesso !");
    }
    
    
    public TipoSelo getTipoSelo() {
        return tipoSelo;
    }

    public void setTipoSelo(TipoSelo tipoSelo) {
        this.tipoSelo = tipoSelo;
    }
    
    
    
}
